package com.song.tools.log.systemlog.core;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 日志类型
 *
 * @author song tools
 * @since 2024-07-04
 */
@AllArgsConstructor
@Getter
public enum LogTypeEnum {

    ERROR("error", "错误日志"),
    INFO("info", "正常日志");

    private final String code;
    private final String desc;

    public static LogTypeEnum of(String code) {
        return Arrays.stream(LogTypeEnum.values()).filter(logTypeEnum -> Objects.equals(logTypeEnum.code, code)).findAny().orElse(null);
    }
}
